home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 176-200 / scopedisk196 / colordemo / colors.bas < prev    next >
BASIC Source File  |  1995-03-19  |  2KB  |  92 lines

  1. rem $event on
  2. rem $option b
  3. rem $option e
  4. rem $option w
  5. rem $option a
  6. rem $option v
  7. rem $option u
  8. rem $option n
  9. rem $option l-
  10. defint a - z
  11. screen 1 ,  640  ,  400  ,  4  ,  4 
  12. window 1,"colordemo...Gerald Faver", ( 0 , 0 )-( 631 , 386 ), 30 ,1
  13. defint a-z
  14. grid_parameters:
  15. top_x = 171 : top_y = 91 : bot_x = 630 : bot_y = 380 
  16. line ( top_x , top_y ) - ( bot_x , bot_y ) , 1 , b 'grid 17 high , 27 across
  17. draw_grid:
  18. doin_it = - 1
  19. os = 100 ' experiment around with where to put 'em
  20. for x = 0 to 15
  21.     line (x*10 + 1 , 1 +  os) - (x*10 + 10 , 10 + os) ,x,bf
  22.     line (x*10 + 1 , 20 + os) - (x*10 + 10 , 30 + os) ,x,bf
  23.     line (x*10 + 1 , 40 + os) - (x*10 + 10 , 50 + os) ,x,bf
  24.     line (x*10 + 1 , 60 + os) - (x*10 + 10 , 70 + os) ,x,bf
  25. next
  26. while doin_it
  27.     locate 2 , 20
  28.     m =mouse(0)
  29.     if m and mouse(1) <= 160 then
  30.         if mouse(2) >= os and mouse(2) <= os + 10  then 
  31.             chce1 = point(mouse(1),mouse(2))
  32.             ? "choice 1=";chce1
  33.         end if
  34.         if mouse(2) >= 20 + os and mouse(2) <= 30 + os then 
  35.  
  36.             chce2 = point(mouse(1),mouse(2))
  37.             ? tab(35) "choice 2=";chce2
  38.         end if
  39.  
  40.         if mouse(2) >= 40 + os and mouse(2) <= 50 + os then 
  41.             ? tab(50)"choice 3=";chce3
  42.             chce3 = point(mouse(1),mouse(2))
  43.  
  44.         end if
  45.  
  46.         if mouse(2) >= 60 + os and mouse(2) <= 70 + os then 
  47.             ? tab(65)"choice 4=";chce4
  48.             chce4 = point(mouse(1),mouse(2))
  49.  
  50.         end if
  51.  
  52.     end if        
  53.     if m then
  54.         ask_box mouse(1) , mouse(2) 
  55.     else
  56.         sleep
  57.     end if
  58. m = 0
  59. wend
  60. window close 1
  61.  
  62. sub draw_box (x! , y! , colr_1 , colr_2 , colr_3 , colr_4) 
  63. shared top_x , top_y
  64. local i , j , x_pix , y_pix
  65. x_pix = x!-top_x : x_pix = x_pix/8+.5
  66. y_pix = y!-top_y : y_pix = y_pix/8+.5
  67. pset (x_pix,y_pix),colr_1: pset (x_pix + 1,y_pix) , colr_2
  68. pset (x_pix,y_pix +1),colr_3 : pset (x_pix+1,y_pix+1) , colr_4
  69.     for i = x!  to x! + 15 step 2
  70.         for j = y! + 1 to y! + 16 step 2
  71.                   pset (i,j   ),colr_1 : pset (i + 1,j) , colr_2
  72.                    pset (i,j +1),colr_3 : pset (i+1,j+1) , colr_4
  73.     next j , i
  74. end sub
  75.  
  76. sub ask_box (x , y )  static
  77. shared top_x , top_y , bot_x , bot_y , chce1 , chce2 , chce3 , chce4
  78. local gx , gy , grd_x , grd_y , x_pixel , y_pixel
  79. if mouse(0) <> - 1 then exit sub
  80. if x  >=  top_x and x <= bot_x - 8 then
  81.         if  y  >=  top_y and y <= bot_y then
  82.             gx = x - top_x   :  gx = gx / 17  + .5
  83.             gy = y - top_y   :  gy = gy / 17 + .5
  84.                 grd_x =  top_X + gx * 17
  85.                 grd_y =  top_y + gy * 17
  86.          draw_box grd_x - 17 , grd_y-17 , chce1 , chce2 , chce3 , chce4
  87.         end if
  88. end if
  89. end sub
  90.  
  91.  
  92.